home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 16977 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.3 KB  |  50 lines

  1. Path: news.bs.tpl.net!news
  2. From: Dieter Lⁿcking <luecking@braunschweig.netsurf.de>
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Copy constructor
  5. Date: Sat, 13 Apr 1996 00:59:42 +0200
  6. Organization: IRD InterNet Services GmbH
  7. Message-ID: <316EE05E.72F7@braunschweig.netsurf.de>
  8. References: <4kjudi$2qj0@holly.ACNS.ColoState.EDU>
  9. NNTP-Posting-Host: plueckin.braunschweig.netsurf.de
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 2.01 (Win95; I)
  14.  
  15. Corby S. Hudnall wrote:
  16. > Hi all, I'm having some trouble figuring out how to do a copy
  17. > constructor.  Here's what I thought was suppose to work:
  18. > header file----
  19. > class ABC
  20. > {
  21. >         private:
  22. >                 int AnInt;
  23. >         public:
  24. >                 ABC():AnInt(5) {}  // Default Constructor
  25. >                 ~ABC() {}          // Default Destructor
  26. >                 ABC(const ABC&);   // Copy constructor
  27. > }
  28.  
  29.   MISSING: ;
  30.  
  31. > ABC::ABC(const ABC& NewABC)
  32. > {
  33. >    this->AnInt = NewABC->AnInt;
  34. > }
  35. > Unfortunatly, I can't get this to work right.  I get weird messages from
  36. > the compiler complaining about not being able to use a class definition
  37. > as an argument.  This was using xlC under IBM Aix.  Any suggestions are
  38. > greatly appreciated.  Thanks.
  39.  
  40. Are any ugly defines invoked ?
  41.  
  42. Bye 
  43.     Dieter
  44.  
  45.